import 'package:car_map/page/res/gaps.dart';
import 'package:car_map/widget/my_button.dart';
import 'package:flutter/material.dart';

class AnnoucePage extends StatefulWidget{
  @override
  _annoucePage createState() =>_annoucePage();

}

class _annoucePage extends State<AnnoucePage>{

  TextEditingController controller;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    controller=TextEditingController();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text(
          '发布公告'
        ),
      ),
      body: Container(
        padding: EdgeInsets.all(10.0),
        child: ListView(
          children: <Widget>[

            Container(
              padding: EdgeInsets.all(5.0),
              decoration: BoxDecoration(
                border: Border(
                  top: BorderSide(
                    color: Colors.black12,
                    width: 0.5
                  ),
                  left: BorderSide(
                      color: Colors.black12,
                      width: 0.5
                  ),
                  right: BorderSide(
                      color: Colors.black12,
                      width: 0.5
                  )
                )
              ),
         child: TextField(
           controller: controller,
           textInputAction: TextInputAction.done,
           maxLines: 10,
           maxLength: 50,
           autocorrect: true,
           autofocus: false,
           textAlign: TextAlign.left,
           decoration: InputDecoration(
               fillColor: Colors.white,
               hintText: '请输入公告内容',
               helperText: '最多50个字',
               focusedBorder: UnderlineInputBorder(
                   borderSide:
                   BorderSide(color: Colors.black12, width: 1)),
               enabledBorder: UnderlineInputBorder(
                   borderSide: BorderSide(
                       color: Colors.black26,
                       width: 1))
           ),

         ),
        ),
            Gaps.vGap50,
            MyButton(
              title: '提交',
              callback: (){
                print(controller.text);
              },
            ),
          ],
        ),
      ),
    );
  }

}














